package top.tagao.multithread_02_use.way;

/**
 * @author fu-xiao-liu
 * @Date 2022/3/29 20:44
 */
public class Way_01_yield {
    public static void main(String[] args) {
        CustomRunnable01 yieldTest = new CustomRunnable01();
        new Thread( yieldTest,"a").start();
        new Thread( yieldTest,"b").start();
    }
}

class CustomRunnable01 implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "开始");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + "结束");
    }
}